import { Component, OnInit } from '@angular/core';
import { RegisterFormData } from '../model/form.data';

@Component({
  selector: 'app-register-body',
  templateUrl: './register-body.component.html',
  styleUrls: ['./register-body.component.scss']
})
export class RegisterBodyComponent implements OnInit {

  showType: 0 | 1 = 0;
  account: RegisterFormData;
  errorMsg: string;

  constructor() { }

  fromSubmit(data: RegisterFormData) {
    this.showType = 1;
    this.account = data;
  }

  accountEvent(event: {type: 1 | 2;  msg: string}) {
    if (event.type === 2) {
      this.errorMsg = event.msg;
    }
    this.showType = 0;
  }

  ngOnInit() {
  }

}
